package com.company.cloud.ad.modules.api.service;

import com.company.cloud.ad.modules.api.response.AdResp;
import com.company.cloud.common.bean.BaseClientResult;
import com.company.common.server.constant.ServiceNameConstant;
import org.springframework.cloud.openfeign.FeignClient;

import com.company.cloud.ad.modules.api.fallback.AdClientServiceFallbackFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;
import java.util.Set;


@FeignClient(contextId="ad", name = ServiceNameConstant.cms_center, fallbackFactory = AdClientServiceFallbackFactory.class )
public interface AdClientService {

    /**广告位获取广告*/
    @RequestMapping(value = "/remote/ad/adByPositionNo", method = RequestMethod.GET)
    public BaseClientResult<List<AdResp>> getAdByPositionNo(@RequestParam("adPositionNo")String adPositionNo, @RequestParam("companyNo")String companyNo);

    /**根据id获取广告*/
    @RequestMapping(value = "/remote/ad/adById", method = RequestMethod.GET)
    public BaseClientResult<AdResp> getAdById(@RequestParam("id") Integer id);

    /**根据id获取广告*/
    @RequestMapping(value = "/remote/ad/adMapById", method = RequestMethod.POST)
    public BaseClientResult<Map<Integer, AdResp>> getAdMapById(@RequestBody Set<Integer> ids);
}
